package myJs.tool

import cats.effect.IO

import scala.scalajs.js.Dynamic.{global => g}
import upickle.default._

import scala.scalajs.js

/**
 * Created by yz on 27/7/2020
 */
object Pojo {

  trait SearchKind

  object TextSearch extends SearchKind

  object DateSearch extends SearchKind

  object NumericSearch extends SearchKind

  object DoubleSearch extends SearchKind

  object CheckboxSearch extends SearchKind

  trait SearchData

  case class TextSearchData(searchType: String, text: String) extends SearchData

  case class DateSearchData(startDate: String, endDate: String) extends SearchData

  case class NumericSearchData(min: String, max: String, kind: String) extends SearchData

  case class CheckboxSearchData(values: List[String]) extends SearchData

  case class SortData(field: String, order: String, kind: String)

  case class ExportData(
    text: String,
    href: js.UndefOr[String] = js.undefined,
    onClick: js.UndefOr[(List[ujson.Obj], List[String]) => IO[Unit]] = js.undefined,
    disabled: Boolean = false
  )

  case class FilterContentData(fieldName: String, label: String, values: List[String] = List[String]())

  case class HighchartsOptions(colors: List[String] = List.empty)

  object HighchartsOptions {
    implicit val rw = macroRW[HighchartsOptions]
  }

}
